import { createApp } from 'vue'
import App from './App.vue'
import { io } from 'socket.io-client'

// 创建Socket连接
const socket = io('http://localhost:3000')

// 监听连接事件
socket.on('connect', () => {
  console.log('Connected to server')
})

// 监听断开连接事件
socket.on('disconnect', () => {
  console.log('Disconnected from server')
})

// 创建Vue应用
const app = createApp(App)

// 将Socket实例添加到全局属性中
app.config.globalProperties.$socket = socket

// 挂载应用
app.mount('#app')
